<%@page pageEncoding="UTF-8"%>
<%@ page session="false" %>
<%@ include file="/WEB-INF/views/includes.jsp" %>
<%@ include file="/WEB-INF/views/header.jsp" %>



<form:form modelAttribute="userPredForm" commandName="userPredForm" action="/users/predictions"  method="post" >

<form:hidden path="userPoolId"/>
<br/>
<br/>


<c:if test="${fn:length(matches)>0}">
	<div id="tablePadding">
	<table id="table-css">
	<caption>Predict the Outcome...</caption>
	<tr>
	<td>Match No
	</td>
	<td>Summary
	</td>
	<td>Venue
	</td>	
	<td>Time
	</td>
	<td colspan="1">Outcome(Pts)
	</td>
	<td colspan="1">Outcome(Pts)
	</td>	
	 <td colspan="1">Outcome(Pts)
	</td>
	<td>Undecided
	</td>	
	</tr>
	<c:forEach var="match" items="${matches}" varStatus="matchIndex">
	<tr <c:if test="${(matchIndex.index%2)==0}"> class='alt'</c:if> >
	<td>${match.matchNo}
	</td>
	<td>${match.summary}
	</td>
	<td>${match.matchLocation}
	</td>	
	<td><fmt:timeZone value="US/Eastern"><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${match.matchDateTime}" /></fmt:timeZone>
	</td>
	<td>
		<table class='tableInTd'>
		<tr>
		<td>${match.matchOpponent1} (${match.matchOpponentPts1})
		</td>
		<td><form:radiobutton path="userPredStr[${matchIndex.index}]"  value="${match.matchOpponent1}"/>
		</td>
		</tr>
		</table>
	</td>
	<td>
		<table class='tableInTd'>
		<tr>
		<td>${match.matchOpponent2} (${match.matchOpponentPts2})
		</td>
		<td><form:radiobutton path="userPredStr[${matchIndex.index}]"  value="${match.matchOpponent2}"/>
		</td>
		</tr>
		</table>	
	</td>		
	<td>TIE (${match.matchTiePts})<form:radiobutton path="userPredStr[${matchIndex.index}]"  value="TIE"/>
	</td>
	<td>Undecided<form:radiobutton path="userPredStr[${matchIndex.index}]"  value="NYD"/>
	</td>				
	</tr>
	</c:forEach>


	</table>
	
				
				
</div><br/>
<div align="center"><input type="submit"  id="submitButton" name="submitButton" value=""/></div>
</c:if>
</form:form>
<br/>


<br/>
<c:if test="${fn:length(userPredForm.history)>0}">
	<div id="tablePadding">	
	<table  id="table-css">
	<caption>View your History...</caption>
	<tr>
	<td>Match No
	</td>
	<td>Match Summary
	</td>
	<td>Match Date
	</td>	
	<td>Prediction
	</td>	
	<td>Points Won
	</td>
	</tr>
	<c:forEach var="histPred" items="${userPredForm.history}" >
	<tr>
	<td>${histPred.matchNo}
	</td>
	<td>${histPred.matchSummary}
	</td>	
	<td><fmt:timeZone value="US/Eastern"><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${histPred.matchDateTime}" /></fmt:timeZone>
	</td>
	<td  <c:if test="${(histPred.predictionPoints)>0}">class='tdColor'</c:if>  >${histPred.matchPrediction}
	</td>
	<td>${histPred.predictionPoints}
	</td>				
	</tr>
	</c:forEach>
	</table>

		
		
	</div>
</c:if>	
	<div id="tablePadding">	
	<br/><br/>
	<table    id="buttonTable">
	<tr>
	<td>
		<a href="<c:url value='/pool/users/${userPredForm.userPoolId}'/>"><img src="/static/images/UserStandings.gif"/></a>
	</td>
	<td ALIGN="right">
		<a href="<c:url value='/pool/users/matrix/${userPredForm.userPoolId}'/>"><img src="/static/images/UserMatrix.gif"/></a>
	</td>
	</tr>
	</table>
	</div>
</body>
</html>